﻿<Window x:Class="CP.NLayer.Client.WpfClient.Login.LoginView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:common="clr-namespace:CP.NLayer.Client.WpfClient.Common;assembly=CP.NLayer.Client.WpfClient.Common"
        xmlns:local="clr-namespace:CP.NLayer.Client.WpfClient.Login"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:l="http://wpflocalizeextension.codeplex.com"
        l:LocalizeDictionary.DesignCulture="en"
        l:ResxLocalizationProvider.DefaultAssembly="CP.NLayer.Resources"
        l:ResxLocalizationProvider.DefaultDictionary="MResources"
        Title="{l:Loc Login, Dict=UiResources}" Height="300" Width="450" ResizeMode="NoResize" WindowStartupLocation="CenterScreen"
        common:DialogCloser.MyDialogResult="{Binding DialogResult}"
        FocusManager.FocusedElement="{Binding ElementName=textBox1}" Icon="/CP.NLayer.Client.WpfClient.Login;component/Images/login.png">
    <Window.Resources>
        <Style TargetType="TextBlock">
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="HorizontalAlignment" Value="Right" />
        </Style>

        <Style TargetType="TextBox">
            <Setter Property="VerticalAlignment" Value="Center" />
        </Style>

        <Style TargetType="PasswordBox">
            <Setter Property="VerticalAlignment" Value="Center" />
        </Style>
    </Window.Resources>
    <Grid>
        <telerik:RadBusyIndicator BusyContent="{Binding RadBusy.BusyContent}" IsBusy="{Binding RadBusy.IsBusy}" IsIndeterminate="{Binding RadBusy.IsIndeterminate}" DisplayAfter="{Binding RadBusy.DisplayAfter}">
            <Grid Width="240" Height="140">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="60" />
                    <ColumnDefinition Width="10" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="28" />
                    <RowDefinition Height="1*" />
                    <RowDefinition Height="28" />
                    <RowDefinition Height="1*" />
                    <RowDefinition Height="28" />
                </Grid.RowDefinitions>
                <TextBlock Text="{l:Loc UserName}" />
                <TextBlock Text="{l:Loc Password}" Grid.Row="2" />
                <TextBlock Text="{l:Loc Language}" Grid.Row="4" />
                <TextBox Name="textBox1" Grid.Column="2" Text="{Binding LoginModel.UserName, Mode=OneWayToSource}" />
                <!--"Bind" Password using event-->
                <PasswordBox Name="passwordBox1" Grid.Row="2" Grid.Column="2" PasswordChanged="PasswordBox1_PasswordChanged" />
                <Grid Grid.Row="4" Grid.Column="2">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="10*" />
                        <ColumnDefinition Width="1*" />
                        <ColumnDefinition Width="10*" />
                    </Grid.ColumnDefinitions>
                    <ComboBox ItemsSource="{Binding SupportedCultures}" SelectedValuePath="Name" DisplayMemberPath="NativeName" SelectedItem="{Binding SelectedCulture}" />
                    <Button Content="{l:Loc Login, Dict=UiResources}" Name="button1" Grid.Row="0"  Grid.Column="2"  Command="{Binding LoginCommand}" IsDefault="True"/>
                </Grid>
            </Grid>
        </telerik:RadBusyIndicator>
    </Grid>
</Window>
